<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ 
	taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%><%@ 
 	taglib prefix="s" uri="/struts-tags"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@ taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<c-rt:set var="hostName" value='<%=request.getServerName()%>'/>
<script type="text/javascript" charset="UTF-8" src="<%=ServerValue.getFrontContextPath()%>/js/jquery.alphanumeric.js"></script>
<script type="text/javascript">
var this_;
$().ready( function() {
	$("#minPrice").numeric({allow:"."});
	$("#maxPrice").numeric({allow:"."});
	$('.top6').hide();
	$('.lesskword').click(function(){
		$(this).hide();
		$('.morekword').show();
		$('.top6').hide();
	});
	$('.morekword').click(function(){
		$(this).hide();
		$('.lesskword').show();
		$('.top6').show();
	});
	//sidebar-category
	$('ul.moreshow').hide();
	<c-rt:if test="${category.level==0}">
	$("div.sh-index-menu > ul.shbar-index > li > ul.shbar-sub > li:has(ul)").each(function(index,item){
		$(this).addClass('loaded');

		var categoryId=$(this).attr('id').split('_')[1];
		document.formObjX.z.value=categoryId;
		var params = jQuery("#formObjX").serialize(); // http request parameters.
		params = encodeURI(params); 
		
		$('ul',this).load('/ecmall/search/subCategory.do?'+params, {}, 
		function(responseText){
			if($.trim(responseText).length>0){
				$('.topHaveMore', this_).addClass('getmore');
			}

		});
		$(this).hover(function(event){
			$("ul.moreshow").each(function(){
				$(this).hide();
			});
			// 停止元素动画
			this_=$(this).children('ul.moreshow');
			if($(this).hasClass('loaded')){
				if($.trim($('ul', this).html()).length>0){
					this_.show();
				}
			}else{
				$(this).addClass('loaded');

				var categoryId=$(this).attr('id').split('_')[1];
				document.formObjX.z.value=categoryId;
				var params = jQuery("#formObjX").serialize(); // http request parameters.
				params = encodeURI(params); 
				
				$('ul',this).load('/ecmall/search/subCategory.do?'+params, {}, 
				function(responseText){
					if($.trim(responseText).length>0){
						$('.topHaveMore', this_).addClass('getmore');
						this_.show();
					}

				});
			}
			

				

		},function(){
			$(this).children('ul.moreshow').hide();
	    });
	});
	</c-rt:if>
	<c-rt:if test="${category.level>0}">
	$("div.sh-index-menu > ul.sdbar-sub > li:has(ul)").each(function(index,item){
		$(this).addClass('loaded');
		$('a', this).removeClass('getmore');
		var categoryId=$(this).attr('id').split('_')[1];
		document.formObjX.z.value=categoryId;
		var params = jQuery("#formObjX").serialize(); // http request parameters.
		params = encodeURI(params); 
		$('ul',this).load('/ecmall/search/subCategory.do?'+params, {}, 
		function(responseText){
			
			if($.trim(responseText).length>0){
				$('.subHaveMore', this_).addClass('getmore');
			}

		});
		$(this).hover(function(event){
			$("ul.moreshow").each(function(){
				$(this).hide();
			});
			// 停止元素动画
			this_=$(this).children('ul.moreshow');
			if($(this).hasClass('loaded')){
				if($.trim($('ul', this).html()).length>0){
					this_.show();
				}
			}else{
				$(this).addClass('loaded');

				var categoryId=$(this).attr('id').split('_')[1];
				document.formObjX.z.value=categoryId;
				var params = jQuery("#formObjX").serialize(); // http request parameters.
				params = encodeURI(params); 
				$('ul',this).load('/ecmall/search/subCategory.do?'+params, {}, 
				function(responseText){
					if($.trim(responseText).length>0){
						$('.subHaveMore', this_).addClass('getmore');
						this_.show();
					}

				});
			}

		},function(){
			$(this).children('ul.moreshow').hide();
	    });
	});
	</c-rt:if>
});

function cleanHistory(){
	var params = jQuery("#formObj").serialize(); // http request parameters.
	params = encodeURI(params); 
	location.href="/ecmall/search/cleanHistory.do?" + params;
}

</script>


<!-- sidebar start -->
<div class="sidebar"><!-- menu -->
<form name="formObjX" id="formObjX">
	<input type="hidden" name="searchWithBrief" value="${!empty param.searchWithBrief?param.searchWithBrief:'0' }"/>
	<input type="hidden" name="searchWithDescription" value="${!empty param.searchWithDescription?param.searchWithDescription:'0' }"/>
	<input type="hidden" name="startDate" value="${param.startDate }"/>
	<input type="hidden" name="endDate" value="${param.endDate }"/>
	<input type="hidden" name="z" class="z" value="${param.z }"/>
	<input type="hidden" name="searchKeyword" value="${pu:urlDecoding(param.searchKeyword, 'UTF-8') }"/>
	<input type="hidden" name="minPrice" value="${param.minPrice }"/>
	<input type="hidden" name="maxPrice" value="${param.maxPrice }"/>
	<input type="hidden" name="brandId" value="${param.brandId }"/>
	
	
</form>
<c-rt:if test="${!empty result1 && result1.total!=0}">
<div class="sh-index-menu">
<h1><b>符合的搜索分类</b></h1>
<ul class="shbar-index">
	<c-rt:if test="${!empty result0.categories}">
		<c-rt:forEach items="${result0.categories}" var="category">
			<c-rt:if test="${!empty pu:split(category.displayName, ',')[1] && category.cqCount>0}">
			
			<c-rt:if test="${param.z==pu:split(category.displayName, ',')[0]}">
			<li>
			<span class="sh-current">${pu:split(category.displayName, ',')[1]} (${category.cqCount})</span>
			<ul class="shbar-sub">
				<c-rt:forEach items="${result1.categories}" var="subCategory">
					<c-rt:if test="${!empty pu:split(subCategory.displayName, ',')[1] && subCategory.cqCount>0}">
					<li id="${pu:split(category.displayName, ',')[0]}_${pu:split(subCategory.displayName, ',')[0]}_${catLevel }"><a class="topHaveMore" href="###" onclick="document.formObj.z.value='${pu:split(subCategory.displayName, ',')[0]}';encodeKeyword2();return false;"> ${pu:split(subCategory.displayName, ',')[1]} (${subCategory.cqCount})  </a>
					<ul class="moreshow" style="display:none">
					</ul>
					
					</li>
					</c-rt:if>
				</c-rt:forEach>
			</ul>
			</li>
			</c-rt:if>
			
			</c-rt:if>
		</c-rt:forEach>
		</ul>
		
		<ul class="sdbar-sub">
		
		<c-rt:forEach items="${catList}" var="catTop">
			<c-rt:forEach items="${result0.categories}" var="category">
			<c-rt:if test="${!empty pu:split(category.displayName, ',')[1] && category.cqCount>0 && catTop.id==pu:split(category.displayName, ',')[0]}">
			${pu:listAdd('catTopList', category) }
			
			</c-rt:if>
			</c-rt:forEach>
		</c-rt:forEach>
		<c-rt:forEach items="${catTopList}" var="category">
		
			<c-rt:if test="${!empty pu:split(category.displayName, ',')[1] && category.cqCount>0}">
			
			<c-rt:if test="${param.z!=pu:split(category.displayName, ',')[0]}">
			<li id="${pu:getParentCategoryId(param.z) }_${pu:split(category.displayName, ',')[0]}_${catLevel-1 }">
			<a class="subHaveMore" href="#" onclick="document.formObj.z.value='${pu:split(category.displayName, ',')[0]}';encodeKeyword2();return false;"> ${pu:split(category.displayName, ',')[1]} (${category.cqCount}) </a>
			<ul class="moreshow" style="display:none">
			</ul>
			
			</li>
			</c-rt:if>

			</c-rt:if>
		</c-rt:forEach>
		</ul>
		
		
		
	</c-rt:if>
	<c-rt:if test="${empty result0.categories}">
	
	<c-rt:if test="${!empty result1.categories}">
	 

		
		<c-rt:forEach items="${catList}" var="catTop">
			<c-rt:forEach items="${result1.categories}" var="category">
			<c-rt:if test="${!empty pu:split(category.displayName, ',')[1] && category.cqCount>0 && catTop.id==pu:split(category.displayName, ',')[0]}">
			${pu:listAdd('catMoreList', category) }
			
			</c-rt:if>
			</c-rt:forEach>
		</c-rt:forEach>

		<c-rt:forEach items="${catMoreList}" var="category">
			
			<li><a href="#" onclick="document.formObj.z.value='${pu:split(category.displayName, ',')[0]}';encodeKeyword2();return false;"> ${pu:split(category.displayName, ',')[1]} (${category.cqCount}) </a>
			
			</li>
			
		</c-rt:forEach>
	</c-rt:if>
	</c-rt:if>
</ul>
<img src="/images/none.gif" alt="" class="sidebar-ft" />
</div>

<!-- menu -->
<div class="search-space"><img src="/images/none.gif" alt="" /></div>
</c-rt:if>
<!-- menu -->
<div class="sh-index-history"> 
        <h1><b>你的搜索歷史</b></h1> 
        <div class="fieldbox"> 
        	<c-rt:if test="${!empty searchHistory.searchItems}">
            <ul class="shbar-history"> 
            <c-rt:forEach items="${searchHistory.searchItems}" var="si" varStatus="status">
            <c-rt:set var="itemsCount" value="${status.count }" scope="request"/>
			<li <c-rt:if test="${status.index>=5 }">class="top6" style="display:none"</c-rt:if>><a href="#" onclick="document.formObj.searchKeyword.value='${si.keyword}';document.formObj.z.value='';encodeKeyword2();return false;">
			<c-rt:if test="${si.keyword==pu:urlDecoding(param.searchKeyword, 'UTF-8')}">
			<b><c-rt:out value="${si.keyword }"/></b>
			</c-rt:if>
			<c-rt:if test="${si.keyword!=pu:urlDecoding(param.searchKeyword, 'UTF-8')}">
			<c-rt:out value="${si.keyword }"/>
			</c-rt:if>
			
			</a></li> 
			</c-rt:forEach>
            
            </ul> 
            <c-rt:if test="${itemsCount>5}">
            <div><a href="#" class="morekword">显示更多历史关键字</a><a href="#" style="display:none;" class="lesskword">收起历史关键字</a></div> 
            <div class="fielddot"> </div> 
            </c-rt:if>
          	</c-rt:if>
          	<c-rt:if test="${empty searchHistory.searchItems}">
          	<ul class="shbar-history">
			<h4>暂无历史关键字</h4>
            </ul>
          	</c-rt:if>
        </div> 
        <c-rt:if test="${!empty searchHistory.searchItems}">
        <ul class="clear-history"> 
          <li><a href="#" onclick="cleanHistory()" class="clear-btn"><span>清除</span></a></li> 
        </ul> 
        </c-rt:if>
        <div class="bline"></div> 
      </div> 
<!-- menu --> <!--menu2 --> <!--menu2 end--> <!--menu2 --> <!--menu2 end-->
<c-rt:if test="${fn:endsWith(hostName, 'yaodian100.com')}">
	<div class="ad-sky"><script type="text/javascript">
		GA_googleFillSlot("yd100_99_search_sidebar_image_01");
	</script></div>
	<div class="lt-bn-end">
	<script type="text/javascript">
		GA_googleFillSlot("yd100_99_search_sidebar_image_02");
		GA_googleFillSlot("yd100_99_search_sidebar_image_03");
	</script>
	
	</div>
</c-rt:if>
</div>
<!-- sidebar end -->